package com.google.project.server.entity;

import java.io.Serializable;

import javax.jdo.annotations.Extension;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
import com.google.project.shared.TaskConstrainDTO;

@SuppressWarnings("serial")
@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable = "true")
public class TaskConstrain implements Serializable {
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	@Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value = "true")
	private String id;
    @Persistent
    private int forTaskId;
	@Persistent
	private  String constrainTaskName;
    @Persistent
    private int constrainTaskId;
    @Persistent 
    private int constrainType;
    
    @Persistent
    private ProjectTask projectTask;
    
    
    
	public TaskConstrain() {
		super();
	}
	
	
	public TaskConstrain( TaskConstrainDTO data ) {
		super();
		this.forTaskId = data.getForTaskId();
		this.constrainTaskName = data.getConstrainTaskName();
		this.constrainTaskId = data.getConstrainTaskId();
		this.constrainType = data.getConstrainType();
	}
	public void updateFromDTO( TaskConstrainDTO data ) {

		this.forTaskId = data.getForTaskId();
		this.constrainTaskName = data.getConstrainTaskName();
		this.constrainTaskId = data.getConstrainTaskId();
		this.constrainType = data.getConstrainType();
	}
	
	public TaskConstrainDTO toDTO() {
		TaskConstrainDTO data = new TaskConstrainDTO();
		data.setConstrainTaskId(constrainTaskId);
		data.setConstrainTaskName(constrainTaskName);
		data.setConstrainType(constrainType);
		data.setForTaskId(forTaskId);
		data.setId(id);
		return data;
	}

	public ProjectTask getProjectTask() {
		return projectTask;
	}
	public void setProjectTask(ProjectTask projectTask) {
		this.projectTask = projectTask;
	}
	
	public String getId() {
		return id;
	}
	
	public void setId(String id) {
		this.id = id;
	}
	public int getForTaskId() {
		return forTaskId;
	}
	public void setForTaskId(int forTaskId) {
		this.forTaskId = forTaskId;
	}
	public String getConstrainTaskName() {
		return constrainTaskName;
	}
	public void setConstrainTaskName(String constrainTaskName) {
		this.constrainTaskName = constrainTaskName;
	}
	public int getConstrainTaskId() {
		return constrainTaskId;
	}
	public void setConstrainTaskId(int constrainTaskId) {
		this.constrainTaskId = constrainTaskId;
	}
	public int getConstrainType() {
		return constrainType;
	}
	public void setConstrainType(int constrainType) {
		this.constrainType = constrainType;
	}
    
    
}
